define(function(require, exports, module) {
    return function(jQuery){
        (function($) {
            /*seajs-content-start*/

            var defaultctrl = function($scope,httpservice){
                var nowmenuul = "";
                $(".mainmenu > li > a").click(function(){
                    if(nowmenuul){
                        nowmenuul.slideUp();
                    }
                    $(this).parent('li').addClass('current').siblings('li').removeClass('current');
                    $(this).next("ul").slideDown();
                    nowmenuul = $(this).next("ul");
                });

                $(".mainmenu > li > ul > li").click(function(){
                    $(".mainmenu > li > ul > li").removeClass('current');
                    $(this).addClass('current');
                });

                $("#btnlogin").click(function(){
                    Login();
                });

                $(document).keypress(function(e){
                    if(e.which==13){
                        Login();
                    }
                });

                $scope.init =function(){

                };

                $scope.init();

                var Login = function(){
              /*      var url = "sysLogins.do?method=checkLogin";
                    var loginName=$("#loginName").val();
                    var pwd = $("#pwd").val();
                    var args={
                        "loginCode":loginName,
                        "password":pwd
                    };
                    httpservice.javaPost(url,args,function(result){
                            if(result.check==0){
                                var treeMenu="";
                                for(  i = 0; i<result.menu.length;i++){
                                    var firstmenu="<li>";
                                    if(result.menu[i].url!=""){//判断是不是首页概览
                                        firstmenu += "<a>"+result.menu[i].menuname+"</a>";
                                    }else{
                                        firstmenu += "<a href='"+result.menu[i].url+"'>"+result.menu[i].menuname+"</a>";
                                    }
                                    if(result.menu[i].menuitems.length>0){
                                        var secondmenu="<ul>";
                                        for(var j=0;j<result.menu[i].menuitems.length;j++){
                                            secondmenu+="<li><a href='"+result.menu[i].menuitems[j].menuurl+"'>"+result.menu[i].menuitems[j].menuname+"</a></li>"
                                        }
                                        secondmenu+="</ul>";
                                        firstmenu+=secondmenu;
                                    }

                                    firstmenu+="</li>";
                                    treeMenu+=firstmenu;
                                }

                                $("#mainmenu").html(treeMenu);
                                $.apply();
                                window.location.href="default.html";
                            }else{
                                $("#txtSign").text("用户名或密码错误!");
                            }
                        }

                    );*/

                    /*var query = "name="+$("#loginName").val()+"&pwd="+$("#pwd").val()+""
                    httpservice.getJSON("sysLogins.do?method=checkLoginCode", query,
                        function (result) {
                            if(result.state){
                                window.location.href="default.html";
                            }
                            else{
                                $("#txtSign").text("用户名或密码错误!");
                            }
                        });*/
                };

                $('.main-right').height($(window).height());
                $scope.$on('loading', function(d, data) {
                    $scope.loadstate = data;
                })
            };
            angular.module('mpos-controller', [])
                .controller('DefaultCtrl', ['$scope','HttpService',defaultctrl]);
            require('modules/controller/page-ctrl')($);
            require('modules/controller/school-ctrl')($);
            require('modules/controller/school2-ctrl')($);
            require('modules/controller/home-ctrl')($);
            require('modules/controller/dataBusiness-ctrl')($);
            require('modules/controller/netPercept-ctrl')($);
            require('modules/controller/hotpointmarket-ctrl')($);
            require('modules/controller/terminalAnalysis-ctrl')($);
            require('modules/controller/customquery-ctrl')($);
            require('modules/controller/systemManagement-ctrl')($);
            require('modules/controller/test2-ctrl')($);
            require('modules/controller/checkIndicator-ctrl')($);
            require('modules/controller/_4gCellReside-ctrl')($);
            require('modules/controller/checkCellIndicator-ctrl')($);
            require('modules/controller/resourceDispatch-ctrl')($);
            require('modules/controller/sparkStreamPara-ctrl')($);
            /*seajs-content-end*/
        })(jQuery);
    }
});